package cn.jiyun.service.fegin;

import cn.jiyun.entity.ResultClass;
import cn.jiyun.entity.day12.*;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.websocket.OnMessage;
import java.util.List;

@FeignClient("day12-contest")
public interface ContestFeginService {
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 10:58
 * @param: [dto]
 * @return: com.github.pagehelper.PageInfo<cn.jiyun.entity.day12.Contest>
 * @annotate:传递查询参数/分页查询竞赛集合
**/
    @PostMapping("/contest/findContestList")
    PageInfo<Contest> findContestList(@RequestBody ContestDTO dto);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 10:59
 * @param: [uid]
 * @return: java.lang.Integer
 * @annotate:根据用户id/查询每个用户竞赛的个数
**/
    @GetMapping("/contest/findContestCount")
    public Integer findContestCount(@RequestParam("uid") Integer uid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 10:59
 * @param: [uid, cid]
 * @return: boolean
 * @annotate:根据用户id,竞赛id/查询用户是否参加了此竞赛
**/
    @GetMapping("/contest/findIsStartOrApplicationFlag")
    boolean findIsStartOrApplicationFlag(@RequestParam("uid") Integer uid,@RequestParam("cid") Integer cid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:01
 * @param: [uid, cid]
 * @return: boolean
 * @annotate:根据用户id,竞赛id/查询用户是否已经参加了此竞赛
**/
    @GetMapping("/contest/UserApplicationContest")
    boolean UserApplicationContest(@RequestParam("uid") Integer uid,@RequestParam("cid") Integer cid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:01
 * @param: [cid]
 * @return: java.util.List<java.lang.Integer>
 * @annotate:根据竞赛id/返回此竞赛所关联的所有试卷的id
**/
    @GetMapping("/contest/findContestTestPaperIds")
    List<Integer> findContestTestPaperIds(@RequestParam("cid") Integer cid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:02
 * @param: [contestAnswer]
 * @return: void
 * @annotate:添加用户所选择的答案到试题答案表
**/
    @PostMapping("/contest/savaUserAnswer")
    void savaUserAnswer(@RequestBody UserContestAnswer contestAnswer);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:02
 * @param: [cid, pid, uid]
 * @return: void
 * @annotate:根据竞赛id,试卷id,用户id清除此竞赛所关联到的所有答案信息(没有用到/没有作用,因为竞赛做的是只能答一次试题)
**/
    @GetMapping("/contest/removerUserTestPaperAnser")
    void removerUserTestPaperAnser(@RequestParam("cid") Integer cid,@RequestParam("pid") Integer pid,@RequestParam("uid") Integer uid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:04
 * @param: [contestOver]
 * @return: void
 * @annotate:修改用户的竞赛结果信息
**/
    @PostMapping("/contest/setUserContestOver")
    void setUserContestOver(@RequestBody UserContestOver contestOver);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:04
 * @param: [uid, cid]
 * @return: java.lang.Integer
 * @annotate:返回此用户是否已经参加了此竞赛1:参加0:未参加 ...
**/
    @GetMapping("/contest/returnUserIsOverContest")
    Integer returnUserIsOverContest(@RequestParam("uid") Integer uid,@RequestParam("cid") Integer cid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:04
 * @param: [cid]
 * @return: java.util.List<cn.jiyun.entity.day12.UserContestOver>
 * @annotate:返回竞赛的所有用户竞赛完成结果信息
**/
    @GetMapping("/contest/findContestResultList")
    List<UserContestOver> findContestResultList(@RequestParam("cid") Integer cid);
/*
 * @description:
 * @author: sjt
 * @date: 2023/8/31 11:05
 * @param: [cid, pid, uid]
 * @return: java.util.List<cn.jiyun.entity.day12.UserContestAnswer>
 * @annotate:返回用户竞赛所选答案
**/
    @GetMapping("/contest/findTopicAnswerList")
    List<UserContestAnswer> findTopicAnswerList(@RequestParam("cid") Integer cid,@RequestParam("pid") Integer pid,@RequestParam("uid") Integer uid);
//查询登录人的竞赛列表
    @PostMapping("/contest/selectLoginUserContestList")
    PageInfo<Contest> selectLoginUserContestList(@RequestParam("uid") Integer uid,@RequestBody ContestDTO contestDTO);
}
